home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / Devcon_Extras / Tech_Articles / How_To_Reset < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.4 KB  |  73 lines

  1.     
  2.      The Official Way to Software Reboot an Amiga - Bryce Nesbitt
  3.  
  4. * Copyright 1988 Commodore-Amiga, Inc.
  5. *  
  6. * Executables based on this information may be used in software
  7. * for Commodore Amiga computers.  All other rights reserved.
  8. * This information is provided "as is"; no warranties are made.  All 
  9. * use is at your own risk. No liability or responsibility is assumed.
  10.  
  11.  
  12. A number of Amiga programmers have had the need to reboot the machine
  13. from within a program.  Since no official guidelines have ever been
  14. published, programmers have used various creative methods.
  15.  
  16. Unfortunately rebooting the machine is very tricky, and most attempts
  17. have been flawed.  The RESET instruction, for example, unconfigures
  18. all memory; after RESET there is no place to run user code!
  19. Most reboot code will break whenever the memory or CPU configuration
  20. is changed.  Other reset code will not work properly on the Amiga 1000.
  21. A special sequence of operations is required to work with all the possible
  22. memory and processor options available for the Amiga.
  23.  
  24. What follows is the one-and-only official supported way to reboot an Amiga
  25. under software control.
  26.  
  27.  
  28.  
  29. ****************************************************************************
  30. *
  31. *   NAME
  32. *    ColdReboot - reboot the Amiga
  33. *
  34. *   SYNOPSIS
  35. *    ColdReboot()
  36. *
  37. *    void ColdReboot(void);
  38. *
  39. *   FUNCTION
  40. *    Reboot the machine.  All external memory and peripherals will be
  41. *    RESET, and the machine will start its power up diagnostics.
  42. *
  43. *    The MagicResetCode must be used exactly as specified here.
  44. *    The MagicResetCode must be longword aligned.  Failure to
  45. *    duplicate the code EXACTLY will result in improper operation
  46. *    under certain system configurations.
  47. *
  48. *   RESULT
  49. *    This function never returns.
  50. *
  51. ****************************************************************************
  52.         XDEF    _ColdReboot
  53.  
  54.         XREF    _LVOSupervisor
  55.  
  56. _ColdReboot:
  57.         move.l    4,a6            ;Get a pointer to ExecBase
  58.         lea.l    MagicResetCode(pc),a5    ;Location of code to RUN
  59.         jsr    _LVOSupervisor(a6)    ;RUN code in Supervisor mode
  60.     ;[NOTE: The jsr is required even though Supervisor never returns.]
  61.  
  62. ;-------------- MagicResetCode ---------DO NOT CHANGE-----------------------
  63.         CNOP    0,4    ;IMPORTANT!  Longword align!  Do not change!
  64. MagicResetCode:
  65.         lea.l    2,a0    ;Point to JMP instruction at start of ROM
  66.         RESET        ;all RAM goes away now!
  67.         jmp    (a0)    ;Rely on prefetch to execute this instruction
  68. ;---------------------------------------DO NOT CHANGE----------------------- 
  69.  
  70.         END
  71.  
  72.  
  73.